"""
ToggleLoggingCommand.py

This class is intended to handle the toggling of logging.
It takes an instance of a close command

Author: Ryan Walters
Date: 10-12-08

$Id: ToggleLoggingCommand.py 339 2008-10-17 03:57:13Z malerba89 $
"""

from Logging import Logging
from Command import Command

class ToggleLoggingCommand(Command):


    def __init__(self, game, log, close_command):
        self.game = game
        self.Log = log
        self.close_command = close_command

    # A function to handle the toggling of logging
    def execute(self, log_Path):
        if self.Log is not None:
            self.Log.close()
            self.Log = None
        elif log_Path is not None:
            self.Log = Logging(self.game, log_Path)
        self.close_command.update_log_reference(self)
